package com.youngwang.lambda;

public class Person implements Comparable{
	public String firstName;
	public String lastName;
	public Integer age;
	
	public Person() {}
	
	public Person(Person person) {
		this.firstName = person.getFirstName();
		this.lastName = person.getLastName();
		this.age = person.getAge();
	}

	public Person(String firstName, String lastName, Integer age) {
		this();
		this.firstName = firstName;
		this.lastName = lastName;
		this.age = age;
	}

	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public Integer getAge() {
		return age;
	}

	public void setAge(Integer age) {
		this.age = age;
	}

	@Override
	public String toString(){
		return "FirstName=" + firstName + ",LastName=" + lastName + ",Age=" + age;
	}

	@Override
	public int compareTo(Object obj){
		if(obj instanceof Person){
			return firstName.compareTo(((Person) obj).getFirstName());
		}
		return 0;
	}

}
